package team.seekers.hula.course.resource.sectionContentComment.controller;


import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.common.entity.PageResult;
import team.seekers.hula.course.resource.sectionContentComment.entity.dao.SectionContentCommentDO;
import team.seekers.hula.course.resource.sectionContentComment.entity.dto.SectionContentCommentQueryManageDTO;
import team.seekers.hula.course.resource.sectionContentComment.entity.dto.SectionContentCommentUpdateDTO;
import team.seekers.hula.course.resource.sectionContentComment.entity.vo.SectionContentCommentManageListVO;
import team.seekers.hula.course.resource.sectionContentComment.service.SectionContentCommentManageService;

/**
 * <p>
 * 回答的评论 前端控制器
 * </p>
 *
 * @author hbc
 * @since 2021-02-18
 */
@Controller
@ApiResponseBody
@RequestMapping("/manage/section-content/comment")
public class SectionContentCommentManageController {

    @Autowired
    private SectionContentCommentManageService sectionContentCommentManageService;

    //分页查询
    @GetMapping("/page")
    public PageResult<SectionContentCommentManageListVO> pageOrderByGood(SectionContentCommentQueryManageDTO queryDTO){
        return sectionContentCommentManageService.pageOrderByGood(queryDTO);
    }

    @PostMapping("/update")
    public void update(@RequestBody SectionContentCommentUpdateDTO updateDTO){
        SectionContentCommentDO sectionContentCommentDO = new SectionContentCommentDO();
        BeanUtils.copyProperties(updateDTO,sectionContentCommentDO);
        sectionContentCommentManageService.updateById(sectionContentCommentDO);
    }

    @GetMapping("/remove")
    public void remove(@RequestParam String id){
        sectionContentCommentManageService.removeById(id);
    }


}

